<?php
class Player
{
    private $name;
    private $race;
    private $class;

    public function __construct($name, $race, $class)
    {
        $this->name = $name;
        $this->race = $this->cleanRace($race);
        $this->class = $this->cleanClass($class);
    }

    public function display()
    {
        echo $this->name ." - " . $this->race . " - " . $this->class;
    }

    public function getName()
    {
        return $this->name;
    }

    public function getRace()
    {
        return $this->race;
    }

    public function getClass()
    {
        return $this->class;
    }

    public function setName($name)
    {
        $this->name = $name;
    }

    public function setRace($race)
    {
        $this->race = $race;
    }

    public function setClass($class)
    {
        $this->class = $class;
    }

    private function cleanRace($race)
    {
        if(strcmp($race, "BloodElf") == 0)
        {
            return "Blood Elf";
        }

        if(strcmp($race, "Scourge") == 0)
        {
            return "Undead";
        }

        return $race;
    }

    private function cleanClass($class)
    {
        if(strcasecmp($class, "DEATHKNIGHT") == 0)
        {
            return "Death Knight";
        }

        return $this->capitalize($class);
    }

    // Turns string to lowercase, then uppercases the first letter
    private function capitalize($str)
    {
        $str = strtolower($str);
        $str = substr_replace($str, strtoupper(substr($str, 0, 1)), 0, 1);

        return $str;
    }
}
?>